package com.froggyware.tadpole.core;

import com.froggyware.tadpole.TadObject;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Steven
 * Date: 09/09/11
 * Time: 18:20
 * To change this template use File | Settings | File Templates.
 */
public interface DataStore {


    public void setConfigurator(DataStoreConfigurator configuration);

    /**
     * Returns a list of all known collection names on disk.
     * @return
     */
    public List<String> getCollectionNames();

    /**
     * Returns a list of all keys found in the given collection.
     * 
     * @param collectionName
     * @return
     */
    public List<String> getObjectIds(String collectionName);

    public void drop();

    public void write(TadObject t);

    public TadObject read(String objectId, Class c);

    public void delete(String key, Class clazz);

    /**
     * Set to true to enable disk compression of the datastore.
     * Compression uses snappy. http://code.google.com/p/snappy-java/
     *  a fast compresser/decompresser written in C++, originally developed by Google.
     *  However, depending upon your dataset the file size many not be significatly small, in fact in many cases
     *  the compression increases disk usage
     *  @param enable true to enable compression, default is false
     */
    public void enableCompression(boolean enable);

}
